1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gtk.TreeView; 26 27 private import gdk.ContentFormats; 28 private import gdk.PaintableIF; 29 private import glib.ConstructionException; 30 private import glib.ListG; 31 private import glib.MemorySlice; 32 private import glib.Str; 33 private import gobject.ObjectG; 34 private import gobject.Signals; 35 private import gtk.CellRenderer; 36 private import gtk.EditableIF; 37 private import gtk.ScrollableIF; 38 private import gtk.ScrollableT; 39 private import gtk.Tooltip; 40 private import gtk.TreeIter; 41 private import gtk.TreeModelIF; 42 private import gtk.TreePath; 43 private import gtk.TreeSelection; 44 private import gtk.TreeViewColumn; 45 private import gtk.Widget; 46 private import gtk.c.functions; 47 public import gtk.c.types; 48 private import std.algorithm; 49 50 51 /** 52 * A widget for displaying both trees and lists 53 * 54 * Widget that displays any object that implements the [iface@Gtk.TreeModel] interface. 55 * 56 * Please refer to the [tree widget conceptual overview](section-tree-widget.html) 57 * for an overview of all the objects and data types related to the tree 58 * widget and how they work together. 59 * 60 * ## Coordinate systems in GtkTreeView API 61 * 62 * Several different coordinate systems are exposed in the `GtkTreeView` API. 63 * These are: 64 * 65 *  66 * 67 * - Widget coordinates: Coordinates relative to the widget (usually `widget->window`). 68 * 69 * - Bin window coordinates: Coordinates relative to the window that GtkTreeView renders to. 70 * 71 * - Tree coordinates: Coordinates relative to the entire scrollable area of GtkTreeView. These 72 * coordinates start at (0, 0) for row 0 of the tree. 73 * 74 * Several functions are available for converting between the different 75 * coordinate systems. The most common translations are between widget and bin 76 * window coordinates and between bin window and tree coordinates. For the 77 * former you can use [method@Gtk.TreeView.convert_widget_to_bin_window_coords] 78 * (and vice versa), for the latter [method@Gtk.TreeView.convert_bin_window_to_tree_coords] 79 * (and vice versa). 80 * 81 * ## `GtkTreeView` as `GtkBuildable` 82 * 83 * The `GtkTreeView` implementation of the `GtkBuildable` interface accepts 84 * [class@Gtk.TreeViewColumn] objects as `<child>` elements and exposes the 85 * internal [class@Gtk.TreeSelection] in UI definitions. 86 * 87 * An example of a UI definition fragment with `GtkTreeView`: 88 * 89 * ```xml 90 * <object class="GtkTreeView" id="treeview"> 91 * <property name="model">liststore1</property> 92 * <child> 93 * <object class="GtkTreeViewColumn" id="test-column"> 94 * <property name="title">Test</property> 95 * <child> 96 * <object class="GtkCellRendererText" id="test-renderer"/> 97 * <attributes> 98 * <attribute name="text">1</attribute> 99 * </attributes> 100 * </child> 101 * </object> 102 * </child> 103 * <child internal-child="selection"> 104 * <object class="GtkTreeSelection" id="selection"> 105 * <signal name="changed" handler="on_treeview_selection_changed"/> 106 * </object> 107 * </child> 108 * </object> 109 * ``` 110 * 111 * ## CSS nodes 112 * 113 * ``` 114 * treeview.view 115 * ├── header 116 * │ ├── button 117 * │ │ ╰── [sort-indicator] 118 * ┊ ┊ 119 * │ ╰── button 120 * │ ╰── [sort-indicator] 121 * │ 122 * ├── [rubberband] 123 * ╰── [dndtarget] 124 * ``` 125 * 126 * `GtkTreeView` has a main CSS node with name `treeview` and style class `.view`. 127 * It has a subnode with name `header`, which is the parent for all the column 128 * header widgets' CSS nodes. 129 * 130 * Each column header consists of a `button`, which among other content, has a 131 * child with name `sort-indicator`, which carries the `.ascending` or `.descending` 132 * style classes when the column header should show a sort indicator. The CSS 133 * is expected to provide a suitable image using the `-gtk-icon-source` property. 134 * 135 * For rubberband selection, a subnode with name `rubberband` is used. 136 * 137 * For the drop target location during DND, a subnode with name `dndtarget` is used. 138 */ 139 public class TreeView : Widget, ScrollableIF 140 { 141 /** the main Gtk struct */ 142 protected GtkTreeView* gtkTreeView; 143 144 /** Get the main Gtk struct */ 145 public GtkTreeView* getTreeViewStruct(bool transferOwnership = false) 146 { 147 if (transferOwnership) 148 ownedRef = false; 149 return gtkTreeView; 150 } 151 152 /** the main Gtk struct as a void* */ 153 protected override void* getStruct() 154 { 155 return cast(void*)gtkTreeView; 156 } 157 158 /** 159 * Sets our main struct and passes it to the parent class. 160 */ 161 public this (GtkTreeView* gtkTreeView, bool ownedRef = false) 162 { 163 this.gtkTreeView = gtkTreeView; 164 super(cast(GtkWidget*)gtkTreeView, ownedRef); 165 } 166 167 // add the Scrollable capabilities 168 mixin ScrollableT!(GtkTreeView); 169 170 171 /** */ 172 public static GType getType() 173 { 174 return gtk_tree_view_get_type(); 175 } 176 177 /** 178 * Creates a new `GtkTreeView` widget. 179 * 180 * Returns: A newly created `GtkTreeView` widget. 181 * 182 * Throws: ConstructionException GTK+ fails to create the object. 183 */ 184 public this() 185 { 186 auto __p = gtk_tree_view_new(); 187 188 if(__p is null) 189 { 190 throw new ConstructionException("null returned by new"); 191 } 192 193 this(cast(GtkTreeView*) __p); 194 } 195 196 /** 197 * Creates a new `GtkTreeView` widget with the model initialized to @model. 198 * 199 * Params: 200 * model = the model. 201 * 202 * Returns: A newly created `GtkTreeView` widget. 203 * 204 * Throws: ConstructionException GTK+ fails to create the object. 205 */ 206 public this(TreeModelIF model) 207 { 208 auto __p = gtk_tree_view_new_with_model((model is null) ? null : model.getTreeModelStruct()); 209 210 if(__p is null) 211 { 212 throw new ConstructionException("null returned by new_with_model"); 213 } 214 215 this(cast(GtkTreeView*) __p); 216 } 217 218 /** 219 * Appends @column to the list of columns. If @tree_view has “fixed_height” 220 * mode enabled, then @column must have its “sizing” property set to be 221 * GTK_TREE_VIEW_COLUMN_FIXED. 222 * 223 * Params: 224 * column = The `GtkTreeViewColumn` to add. 225 * 226 * Returns: The number of columns in @tree_view after appending. 227 */ 228 public int appendColumn(TreeViewColumn column) 229 { 230 return gtk_tree_view_append_column(gtkTreeView, (column is null) ? null : column.getTreeViewColumnStruct()); 231 } 232 233 /** 234 * Recursively collapses all visible, expanded nodes in @tree_view. 235 */ 236 public void collapseAll() 237 { 238 gtk_tree_view_collapse_all(gtkTreeView); 239 } 240 241 /** 242 * Collapses a row (hides its child rows, if they exist). 243 * 244 * Params: 245 * path = path to a row in the @tree_view 246 * 247 * Returns: %TRUE if the row was collapsed. 248 */ 249 public bool collapseRow(TreePath path) 250 { 251 return gtk_tree_view_collapse_row(gtkTreeView, (path is null) ? null : path.getTreePathStruct()) != 0; 252 } 253 254 /** 255 * Resizes all columns to their optimal width. Only works after the 256 * treeview has been realized. 257 */ 258 public void columnsAutosize() 259 { 260 gtk_tree_view_columns_autosize(gtkTreeView); 261 } 262 263 /** 264 * Converts bin_window coordinates to coordinates for the 265 * tree (the full scrollable area of the tree). 266 * 267 * Params: 268 * bx = X coordinate relative to bin_window 269 * by = Y coordinate relative to bin_window 270 * tx = return location for tree X coordinate 271 * ty = return location for tree Y coordinate 272 */ 273 public void convertBinWindowToTreeCoords(int bx, int by, out int tx, out int ty) 274 { 275 gtk_tree_view_convert_bin_window_to_tree_coords(gtkTreeView, bx, by, &tx, &ty); 276 } 277 278 /** 279 * Converts bin_window coordinates to widget relative coordinates. 280 * 281 * Params: 282 * bx = bin_window X coordinate 283 * by = bin_window Y coordinate 284 * wx = return location for widget X coordinate 285 * wy = return location for widget Y coordinate 286 */ 287 public void convertBinWindowToWidgetCoords(int bx, int by, out int wx, out int wy) 288 { 289 gtk_tree_view_convert_bin_window_to_widget_coords(gtkTreeView, bx, by, &wx, &wy); 290 } 291 292 /** 293 * Converts tree coordinates (coordinates in full scrollable area of the tree) 294 * to bin_window coordinates. 295 * 296 * Params: 297 * tx = tree X coordinate 298 * ty = tree Y coordinate 299 * bx = return location for X coordinate relative to bin_window 300 * by = return location for Y coordinate relative to bin_window 301 */ 302 public void convertTreeToBinWindowCoords(int tx, int ty, out int bx, out int by) 303 { 304 gtk_tree_view_convert_tree_to_bin_window_coords(gtkTreeView, tx, ty, &bx, &by); 305 } 306 307 /** 308 * Converts tree coordinates (coordinates in full scrollable area of the tree) 309 * to widget coordinates. 310 * 311 * Params: 312 * tx = X coordinate relative to the tree 313 * ty = Y coordinate relative to the tree 314 * wx = return location for widget X coordinate 315 * wy = return location for widget Y coordinate 316 */ 317 public void convertTreeToWidgetCoords(int tx, int ty, out int wx, out int wy) 318 { 319 gtk_tree_view_convert_tree_to_widget_coords(gtkTreeView, tx, ty, &wx, &wy); 320 } 321 322 /** 323 * Converts widget coordinates to coordinates for the bin_window. 324 * 325 * Params: 326 * wx = X coordinate relative to the widget 327 * wy = Y coordinate relative to the widget 328 * bx = return location for bin_window X coordinate 329 * by = return location for bin_window Y coordinate 330 */ 331 public void convertWidgetToBinWindowCoords(int wx, int wy, out int bx, out int by) 332 { 333 gtk_tree_view_convert_widget_to_bin_window_coords(gtkTreeView, wx, wy, &bx, &by); 334 } 335 336 /** 337 * Converts widget coordinates to coordinates for the 338 * tree (the full scrollable area of the tree). 339 * 340 * Params: 341 * wx = X coordinate relative to the widget 342 * wy = Y coordinate relative to the widget 343 * tx = return location for tree X coordinate 344 * ty = return location for tree Y coordinate 345 */ 346 public void convertWidgetToTreeCoords(int wx, int wy, out int tx, out int ty) 347 { 348 gtk_tree_view_convert_widget_to_tree_coords(gtkTreeView, wx, wy, &tx, &ty); 349 } 350 351 /** 352 * Creates a `cairo_surface_t` representation of the row at @path. 353 * This image is used for a drag icon. 354 * 355 * Params: 356 * path = a `GtkTreePath` in @tree_view 357 * 358 * Returns: a newly-allocated surface of the drag icon. 359 */ 360 public PaintableIF createRowDragIcon(TreePath path) 361 { 362 auto __p = gtk_tree_view_create_row_drag_icon(gtkTreeView, (path is null) ? null : path.getTreePathStruct()); 363 364 if(__p is null) 365 { 366 return null; 367 } 368 369 return ObjectG.getDObject!(PaintableIF)(cast(GdkPaintable*) __p, true); 370 } 371 372 /** 373 * Turns @tree_view into a drop destination for automatic DND. Calling 374 * this method sets `GtkTreeView`:reorderable to %FALSE. 375 * 376 * Params: 377 * formats = the target formats that the drag will support 378 * actions = the bitmask of possible actions for a drag from this 379 * widget 380 */ 381 public void enableModelDragDest(ContentFormats formats, GdkDragAction actions) 382 { 383 gtk_tree_view_enable_model_drag_dest(gtkTreeView, (formats is null) ? null : formats.getContentFormatsStruct(), actions); 384 } 385 386 /** 387 * Turns @tree_view into a drag source for automatic DND. Calling this 388 * method sets `GtkTreeView`:reorderable to %FALSE. 389 * 390 * Params: 391 * startButtonMask = Mask of allowed buttons to start drag 392 * formats = the target formats that the drag will support 393 * actions = the bitmask of possible actions for a drag from this 394 * widget 395 */ 396 public void enableModelDragSource(GdkModifierType startButtonMask, ContentFormats formats, GdkDragAction actions) 397 { 398 gtk_tree_view_enable_model_drag_source(gtkTreeView, startButtonMask, (formats is null) ? null : formats.getContentFormatsStruct(), actions); 399 } 400 401 /** 402 * Recursively expands all nodes in the @tree_view. 403 */ 404 public void expandAll() 405 { 406 gtk_tree_view_expand_all(gtkTreeView); 407 } 408 409 /** 410 * Opens the row so its children are visible. 411 * 412 * Params: 413 * path = path to a row 414 * openAll = whether to recursively expand, or just expand immediate children 415 * 416 * Returns: %TRUE if the row existed and had children 417 */ 418 public bool expandRow(TreePath path, bool openAll) 419 { 420 return gtk_tree_view_expand_row(gtkTreeView, (path is null) ? null : path.getTreePathStruct(), openAll) != 0; 421 } 422 423 /** 424 * Expands the row at @path. This will also expand all parent rows of 425 * @path as necessary. 426 * 427 * Params: 428 * path = path to a row. 429 */ 430 public void expandToPath(TreePath path) 431 { 432 gtk_tree_view_expand_to_path(gtkTreeView, (path is null) ? null : path.getTreePathStruct()); 433 } 434 435 /** 436 * Gets the setting set by gtk_tree_view_set_activate_on_single_click(). 437 * 438 * Returns: %TRUE if row-activated will be emitted on a single click 439 */ 440 public bool getActivateOnSingleClick() 441 { 442 return gtk_tree_view_get_activate_on_single_click(gtkTreeView) != 0; 443 } 444 445 /** 446 * Fills the bounding rectangle in bin_window coordinates for the cell at the 447 * row specified by @path and the column specified by @column. If @path is 448 * %NULL, or points to a node not found in the tree, the @y and @height fields of 449 * the rectangle will be filled with 0. If @column is %NULL, the @x and @width 450 * fields will be filled with 0. The returned rectangle is equivalent to the 451 * @background_area passed to gtk_cell_renderer_render(). These background 452 * areas tile to cover the entire bin window. Contrast with the @cell_area, 453 * returned by gtk_tree_view_get_cell_area(), which returns only the cell 454 * itself, excluding surrounding borders and the tree expander area. 455 * 456 * Params: 457 * path = a `GtkTreePath` for the row, or %NULL to get only horizontal coordinates 458 * column = a `GtkTreeViewColumn` for the column, or %NULL to get only vertical coordinates 459 * rect = rectangle to fill with cell background rect 460 */ 461 public void getBackgroundArea(TreePath path, TreeViewColumn column, out GdkRectangle rect) 462 { 463 gtk_tree_view_get_background_area(gtkTreeView, (path is null) ? null : path.getTreePathStruct(), (column is null) ? null : column.getTreeViewColumnStruct(), &rect); 464 } 465 466 /** 467 * Fills the bounding rectangle in bin_window coordinates for the cell at the 468 * row specified by @path and the column specified by @column. If @path is 469 * %NULL, or points to a path not currently displayed, the @y and @height fields 470 * of the rectangle will be filled with 0. If @column is %NULL, the @x and @width 471 * fields will be filled with 0. The sum of all cell rects does not cover the 472 * entire tree; there are extra pixels in between rows, for example. The 473 * returned rectangle is equivalent to the @cell_area passed to 474 * gtk_cell_renderer_render(). This function is only valid if @tree_view is 475 * realized. 476 * 477 * Params: 478 * path = a `GtkTreePath` for the row, or %NULL to get only horizontal coordinates 479 * column = a `GtkTreeViewColumn` for the column, or %NULL to get only vertical coordinates 480 * rect = rectangle to fill with cell rect 481 */ 482 public void getCellArea(TreePath path, TreeViewColumn column, out GdkRectangle rect) 483 { 484 gtk_tree_view_get_cell_area(gtkTreeView, (path is null) ? null : path.getTreePathStruct(), (column is null) ? null : column.getTreeViewColumnStruct(), &rect); 485 } 486 487 /** 488 * Gets the `GtkTreeViewColumn` at the given position in the #tree_view. 489 * 490 * Params: 491 * n = The position of the column, counting from 0. 492 * 493 * Returns: The `GtkTreeViewColumn`, or %NULL if the 494 * position is outside the range of columns. 495 */ 496 public TreeViewColumn getColumn(int n) 497 { 498 auto __p = gtk_tree_view_get_column(gtkTreeView, n); 499 500 if(__p is null) 501 { 502 return null; 503 } 504 505 return ObjectG.getDObject!(TreeViewColumn)(cast(GtkTreeViewColumn*) __p); 506 } 507 508 /** 509 * Returns a `GList` of all the `GtkTreeViewColumn`s currently in @tree_view. 510 * The returned list must be freed with g_list_free (). 511 * 512 * Returns: A list of `GtkTreeViewColumn`s 513 */ 514 public ListG getColumns() 515 { 516 auto __p = gtk_tree_view_get_columns(gtkTreeView); 517 518 if(__p is null) 519 { 520 return null; 521 } 522 523 return new ListG(cast(GList*) __p); 524 } 525 526 /** 527 * Fills in @path and @focus_column with the current path and focus column. If 528 * the cursor isn’t currently set, then *@path will be %NULL. If no column 529 * currently has focus, then *@focus_column will be %NULL. 530 * 531 * The returned `GtkTreePath` must be freed with gtk_tree_path_free() when 532 * you are done with it. 533 * 534 * Params: 535 * path = A pointer to be 536 * filled with the current cursor path 537 * focusColumn = A 538 * pointer to be filled with the current focus column 539 */ 540 public void getCursor(out TreePath path, out TreeViewColumn focusColumn) 541 { 542 GtkTreePath* outpath = null; 543 GtkTreeViewColumn* outfocusColumn = null; 544 545 gtk_tree_view_get_cursor(gtkTreeView, &outpath, &outfocusColumn); 546 547 path = ObjectG.getDObject!(TreePath)(outpath); 548 focusColumn = ObjectG.getDObject!(TreeViewColumn)(outfocusColumn); 549 } 550 551 /** 552 * Determines the destination row for a given position. @drag_x and 553 * @drag_y are expected to be in widget coordinates. This function is only 554 * meaningful if @tree_view is realized. Therefore this function will always 555 * return %FALSE if @tree_view is not realized or does not have a model. 556 * 557 * Params: 558 * dragX = the position to determine the destination row for 559 * dragY = the position to determine the destination row for 560 * path = Return location for the path of 561 * the highlighted row 562 * pos = Return location for the drop position, or 563 * %NULL 564 * 565 * Returns: whether there is a row at the given position, %TRUE if this 566 * is indeed the case. 567 */ 568 public bool getDestRowAtPos(int dragX, int dragY, out TreePath path, out GtkTreeViewDropPosition pos) 569 { 570 GtkTreePath* outpath = null; 571 572 auto __p = gtk_tree_view_get_dest_row_at_pos(gtkTreeView, dragX, dragY, &outpath, &pos) != 0; 573 574 path = ObjectG.getDObject!(TreePath)(outpath); 575 576 return __p; 577 } 578 579 /** 580 * Gets information about the row that is highlighted for feedback. 581 * 582 * Params: 583 * path = Return location for the path of the highlighted row 584 * pos = Return location for the drop position 585 */ 586 public void getDragDestRow(out TreePath path, out GtkTreeViewDropPosition pos) 587 { 588 GtkTreePath* outpath = null; 589 590 gtk_tree_view_get_drag_dest_row(gtkTreeView, &outpath, &pos); 591 592 path = ObjectG.getDObject!(TreePath)(outpath); 593 } 594 595 /** 596 * Returns whether or not the tree allows to start interactive searching 597 * by typing in text. 598 * 599 * Returns: whether or not to let the user search interactively 600 */ 601 public bool getEnableSearch() 602 { 603 return gtk_tree_view_get_enable_search(gtkTreeView) != 0; 604 } 605 606 /** 607 * Returns whether or not tree lines are drawn in @tree_view. 608 * 609 * Returns: %TRUE if tree lines are drawn in @tree_view, %FALSE 610 * otherwise. 611 */ 612 public bool getEnableTreeLines() 613 { 614 return gtk_tree_view_get_enable_tree_lines(gtkTreeView) != 0; 615 } 616 617 /** 618 * Returns the column that is the current expander column, 619 * or %NULL if none has been set. 620 * This column has the expander arrow drawn next to it. 621 * 622 * Returns: The expander column. 623 */ 624 public TreeViewColumn getExpanderColumn() 625 { 626 auto __p = gtk_tree_view_get_expander_column(gtkTreeView); 627 628 if(__p is null) 629 { 630 return null; 631 } 632 633 return ObjectG.getDObject!(TreeViewColumn)(cast(GtkTreeViewColumn*) __p); 634 } 635 636 /** 637 * Returns whether fixed height mode is turned on for @tree_view. 638 * 639 * Returns: %TRUE if @tree_view is in fixed height mode 640 */ 641 public bool getFixedHeightMode() 642 { 643 return gtk_tree_view_get_fixed_height_mode(gtkTreeView) != 0; 644 } 645 646 /** 647 * Returns which grid lines are enabled in @tree_view. 648 * 649 * Returns: a `GtkTreeView`GridLines value indicating which grid lines 650 * are enabled. 651 */ 652 public GtkTreeViewGridLines getGridLines() 653 { 654 return gtk_tree_view_get_grid_lines(gtkTreeView); 655 } 656 657 /** 658 * Returns whether all header columns are clickable. 659 * 660 * Returns: %TRUE if all header columns are clickable, otherwise %FALSE 661 */ 662 public bool getHeadersClickable() 663 { 664 return gtk_tree_view_get_headers_clickable(gtkTreeView) != 0; 665 } 666 667 /** 668 * Returns %TRUE if the headers on the @tree_view are visible. 669 * 670 * Returns: Whether the headers are visible or not. 671 */ 672 public bool getHeadersVisible() 673 { 674 return gtk_tree_view_get_headers_visible(gtkTreeView) != 0; 675 } 676 677 /** 678 * Returns whether hover expansion mode is turned on for @tree_view. 679 * 680 * Returns: %TRUE if @tree_view is in hover expansion mode 681 */ 682 public bool getHoverExpand() 683 { 684 return gtk_tree_view_get_hover_expand(gtkTreeView) != 0; 685 } 686 687 /** 688 * Returns whether hover selection mode is turned on for @tree_view. 689 * 690 * Returns: %TRUE if @tree_view is in hover selection mode 691 */ 692 public bool getHoverSelection() 693 { 694 return gtk_tree_view_get_hover_selection(gtkTreeView) != 0; 695 } 696 697 /** 698 * Returns the amount, in pixels, of extra indentation for child levels 699 * in @tree_view. 700 * 701 * Returns: the amount of extra indentation for child levels in 702 * @tree_view. A return value of 0 means that this feature is disabled. 703 */ 704 public int getLevelIndentation() 705 { 706 return gtk_tree_view_get_level_indentation(gtkTreeView); 707 } 708 709 /** 710 * Returns the model the `GtkTreeView` is based on. Returns %NULL if the 711 * model is unset. 712 * 713 * Returns: A `GtkTreeModel` 714 */ 715 public TreeModelIF getModel() 716 { 717 auto __p = gtk_tree_view_get_model(gtkTreeView); 718 719 if(__p is null) 720 { 721 return null; 722 } 723 724 return ObjectG.getDObject!(TreeModelIF)(cast(GtkTreeModel*) __p); 725 } 726 727 /** 728 * Queries the number of columns in the given @tree_view. 729 * 730 * Returns: The number of columns in the @tree_view 731 */ 732 public uint getNColumns() 733 { 734 return gtk_tree_view_get_n_columns(gtkTreeView); 735 } 736 737 /** 738 * Finds the path at the point (@x, @y), relative to bin_window coordinates. 739 * That is, @x and @y are relative to an events coordinates. Widget-relative 740 * coordinates must be converted using 741 * gtk_tree_view_convert_widget_to_bin_window_coords(). It is primarily for 742 * things like popup menus. If @path is non-%NULL, then it will be filled 743 * with the `GtkTreePath` at that point. This path should be freed with 744 * gtk_tree_path_free(). If @column is non-%NULL, then it will be filled 745 * with the column at that point. @cell_x and @cell_y return the coordinates 746 * relative to the cell background (i.e. the @background_area passed to 747 * gtk_cell_renderer_render()). This function is only meaningful if 748 * @tree_view is realized. Therefore this function will always return %FALSE 749 * if @tree_view is not realized or does not have a model. 750 * 751 * For converting widget coordinates (eg. the ones you get from 752 * GtkWidget::query-tooltip), please see 753 * gtk_tree_view_convert_widget_to_bin_window_coords(). 754 * 755 * Params: 756 * x = The x position to be identified (relative to bin_window). 757 * y = The y position to be identified (relative to bin_window). 758 * path = A pointer to a `GtkTreePath` 759 * pointer to be filled in 760 * column = A pointer to 761 * a `GtkTreeViewColumn` pointer to be filled in 762 * cellX = A pointer where the X coordinate 763 * relative to the cell can be placed 764 * cellY = A pointer where the Y coordinate 765 * relative to the cell can be placed 766 * 767 * Returns: %TRUE if a row exists at that coordinate. 768 */ 769 public bool getPathAtPos(int x, int y, out TreePath path, out TreeViewColumn column, out int cellX, out int cellY) 770 { 771 GtkTreePath* outpath = null; 772 GtkTreeViewColumn* outcolumn = null; 773 774 auto __p = gtk_tree_view_get_path_at_pos(gtkTreeView, x, y, &outpath, &outcolumn, &cellX, &cellY) != 0; 775 776 path = ObjectG.getDObject!(TreePath)(outpath); 777 column = ObjectG.getDObject!(TreeViewColumn)(outcolumn); 778 779 return __p; 780 } 781 782 /** 783 * Retrieves whether the user can reorder the tree via drag-and-drop. See 784 * gtk_tree_view_set_reorderable(). 785 * 786 * Returns: %TRUE if the tree can be reordered. 787 */ 788 public bool getReorderable() 789 { 790 return gtk_tree_view_get_reorderable(gtkTreeView) != 0; 791 } 792 793 /** 794 * Returns the current row separator function. 795 * 796 * Returns: the current row separator function. 797 */ 798 public GtkTreeViewRowSeparatorFunc getRowSeparatorFunc() 799 { 800 return gtk_tree_view_get_row_separator_func(gtkTreeView); 801 } 802 803 /** 804 * Returns whether rubber banding is turned on for @tree_view. If the 805 * selection mode is %GTK_SELECTION_MULTIPLE, rubber banding will allow the 806 * user to select multiple rows by dragging the mouse. 807 * 808 * Returns: %TRUE if rubber banding in @tree_view is enabled. 809 */ 810 public bool getRubberBanding() 811 { 812 return gtk_tree_view_get_rubber_banding(gtkTreeView) != 0; 813 } 814 815 /** 816 * Gets the column searched on by the interactive search code. 817 * 818 * Returns: the column the interactive search code searches in. 819 */ 820 public int getSearchColumn() 821 { 822 return gtk_tree_view_get_search_column(gtkTreeView); 823 } 824 825 /** 826 * Returns the `GtkEntry` which is currently in use as interactive search 827 * entry for @tree_view. In case the built-in entry is being used, %NULL 828 * will be returned. 829 * 830 * Returns: the entry currently in use as search entry. 831 */ 832 public EditableIF getSearchEntry() 833 { 834 auto __p = gtk_tree_view_get_search_entry(gtkTreeView); 835 836 if(__p is null) 837 { 838 return null; 839 } 840 841 return ObjectG.getDObject!(EditableIF)(cast(GtkEditable*) __p); 842 } 843 844 /** 845 * Returns the compare function currently in use. 846 * 847 * Returns: the currently used compare function for the search code. 848 */ 849 public GtkTreeViewSearchEqualFunc getSearchEqualFunc() 850 { 851 return gtk_tree_view_get_search_equal_func(gtkTreeView); 852 } 853 854 /** 855 * Gets the `GtkTreeSelection` associated with @tree_view. 856 * 857 * Returns: A `GtkTreeSelection` object. 858 */ 859 public TreeSelection getSelection() 860 { 861 auto __p = gtk_tree_view_get_selection(gtkTreeView); 862 863 if(__p is null) 864 { 865 return null; 866 } 867 868 return ObjectG.getDObject!(TreeSelection)(cast(GtkTreeSelection*) __p); 869 } 870 871 /** 872 * Returns whether or not expanders are drawn in @tree_view. 873 * 874 * Returns: %TRUE if expanders are drawn in @tree_view, %FALSE 875 * otherwise. 876 */ 877 public bool getShowExpanders() 878 { 879 return gtk_tree_view_get_show_expanders(gtkTreeView) != 0; 880 } 881 882 /** 883 * Returns the column of @tree_view’s model which is being used for 884 * displaying tooltips on @tree_view’s rows. 885 * 886 * Returns: the index of the tooltip column that is currently being 887 * used, or -1 if this is disabled. 888 */ 889 public int getTooltipColumn() 890 { 891 return gtk_tree_view_get_tooltip_column(gtkTreeView); 892 } 893 894 /** 895 * This function is supposed to be used in a ::query-tooltip 896 * signal handler for `GtkTreeView`. The @x, @y and @keyboard_tip values 897 * which are received in the signal handler, should be passed to this 898 * function without modification. 899 * 900 * The return value indicates whether there is a tree view row at the given 901 * coordinates (%TRUE) or not (%FALSE) for mouse tooltips. For keyboard 902 * tooltips the row returned will be the cursor row. When %TRUE, then any of 903 * @model, @path and @iter which have been provided will be set to point to 904 * that row and the corresponding model. @x and @y will always be converted 905 * to be relative to @tree_view’s bin_window if @keyboard_tooltip is %FALSE. 906 * 907 * Params: 908 * x = the x coordinate (relative to widget coordinates) 909 * y = the y coordinate (relative to widget coordinates) 910 * keyboardTip = whether this is a keyboard tooltip or not 911 * model = a pointer to 912 * receive a `GtkTreeModel` 913 * path = a pointer to receive a `GtkTreePath` 914 * iter = a pointer to receive a `GtkTreeIter` 915 * 916 * Returns: whether or not the given tooltip context points to a row 917 */ 918 public bool getTooltipContext(int x, int y, bool keyboardTip, out TreeModelIF model, out TreePath path, out TreeIter iter) 919 { 920 GtkTreeModel* outmodel = null; 921 GtkTreePath* outpath = null; 922 GtkTreeIter* outiter = sliceNew!GtkTreeIter(); 923 924 auto __p = gtk_tree_view_get_tooltip_context(gtkTreeView, x, y, keyboardTip, &outmodel, &outpath, outiter) != 0; 925 926 model = ObjectG.getDObject!(TreeModelIF)(outmodel); 927 path = ObjectG.getDObject!(TreePath)(outpath); 928 iter = ObjectG.getDObject!(TreeIter)(outiter, true); 929 930 return __p; 931 } 932 933 /** 934 * Sets @start_path and @end_path to be the first and last visible path. 935 * Note that there may be invisible paths in between. 936 * 937 * The paths should be freed with gtk_tree_path_free() after use. 938 * 939 * Params: 940 * startPath = Return location for start of region 941 * endPath = Return location for end of region 942 * 943 * Returns: %TRUE, if valid paths were placed in @start_path and @end_path. 944 */ 945 public bool getVisibleRange(out TreePath startPath, out TreePath endPath) 946 { 947 GtkTreePath* outstartPath = null; 948 GtkTreePath* outendPath = null; 949 950 auto __p = gtk_tree_view_get_visible_range(gtkTreeView, &outstartPath, &outendPath) != 0; 951 952 startPath = ObjectG.getDObject!(TreePath)(outstartPath); 953 endPath = ObjectG.getDObject!(TreePath)(outendPath); 954 955 return __p; 956 } 957 958 /** 959 * Fills @visible_rect with the currently-visible region of the 960 * buffer, in tree coordinates. Convert to bin_window coordinates with 961 * gtk_tree_view_convert_tree_to_bin_window_coords(). 962 * Tree coordinates start at 0,0 for row 0 of the tree, and cover the entire 963 * scrollable area of the tree. 964 * 965 * Params: 966 * visibleRect = rectangle to fill 967 */ 968 public void getVisibleRect(out GdkRectangle visibleRect) 969 { 970 gtk_tree_view_get_visible_rect(gtkTreeView, &visibleRect); 971 } 972 973 /** 974 * This inserts the @column into the @tree_view at @position. If @position is 975 * -1, then the column is inserted at the end. If @tree_view has 976 * “fixed_height” mode enabled, then @column must have its “sizing” property 977 * set to be GTK_TREE_VIEW_COLUMN_FIXED. 978 * 979 * Params: 980 * column = The `GtkTreeViewColumn` to be inserted. 981 * position = The position to insert @column in. 982 * 983 * Returns: The number of columns in @tree_view after insertion. 984 */ 985 public int insertColumn(TreeViewColumn column, int position) 986 { 987 return gtk_tree_view_insert_column(gtkTreeView, (column is null) ? null : column.getTreeViewColumnStruct(), position); 988 } 989 990 /** 991 * Convenience function that inserts a new column into the `GtkTreeView` 992 * with the given cell renderer and a `GtkTreeCellDataFunc` to set cell renderer 993 * attributes (normally using data from the model). See also 994 * gtk_tree_view_column_set_cell_data_func(), gtk_tree_view_column_pack_start(). 995 * If @tree_view has “fixed_height” mode enabled, then the new column will have its 996 * “sizing” property set to be GTK_TREE_VIEW_COLUMN_FIXED. 997 * 998 * Params: 999 * position = Position to insert, -1 for append 1000 * title = column title 1001 * cell = cell renderer for column 1002 * func = function to set attributes of cell renderer 1003 * data = data for @func 1004 * dnotify = destroy notifier for @data 1005 * 1006 * Returns: number of columns in the tree view post-insert 1007 */ 1008 public int insertColumnWithDataFunc(int position, string title, CellRenderer cell, GtkTreeCellDataFunc func, void* data, GDestroyNotify dnotify) 1009 { 1010 return gtk_tree_view_insert_column_with_data_func(gtkTreeView, position, Str.toStringz(title), (cell is null) ? null : cell.getCellRendererStruct(), func, data, dnotify); 1011 } 1012 1013 /** 1014 * Determine whether the point (@x, @y) in @tree_view is blank, that is no 1015 * cell content nor an expander arrow is drawn at the location. If so, the 1016 * location can be considered as the background. You might wish to take 1017 * special action on clicks on the background, such as clearing a current 1018 * selection, having a custom context menu or starting rubber banding. 1019 * 1020 * The @x and @y coordinate that are provided must be relative to bin_window 1021 * coordinates. Widget-relative coordinates must be converted using 1022 * gtk_tree_view_convert_widget_to_bin_window_coords(). 1023 * 1024 * For converting widget coordinates (eg. the ones you get from 1025 * GtkWidget::query-tooltip), please see 1026 * gtk_tree_view_convert_widget_to_bin_window_coords(). 1027 * 1028 * The @path, @column, @cell_x and @cell_y arguments will be filled in 1029 * likewise as for gtk_tree_view_get_path_at_pos(). Please see 1030 * gtk_tree_view_get_path_at_pos() for more information. 1031 * 1032 * Params: 1033 * x = The x position to be identified (relative to bin_window) 1034 * y = The y position to be identified (relative to bin_window) 1035 * path = A pointer to a `GtkTreePath` pointer to 1036 * be filled in 1037 * column = A pointer to a 1038 * `GtkTreeViewColumn` pointer to be filled in 1039 * cellX = A pointer where the X coordinate relative to the 1040 * cell can be placed 1041 * cellY = A pointer where the Y coordinate relative to the 1042 * cell can be placed 1043 * 1044 * Returns: %TRUE if the area at the given coordinates is blank, 1045 * %FALSE otherwise. 1046 */ 1047 public bool isBlankAtPos(int x, int y, out TreePath path, out TreeViewColumn column, out int cellX, out int cellY) 1048 { 1049 GtkTreePath* outpath = null; 1050 GtkTreeViewColumn* outcolumn = null; 1051 1052 auto __p = gtk_tree_view_is_blank_at_pos(gtkTreeView, x, y, &outpath, &outcolumn, &cellX, &cellY) != 0; 1053 1054 path = ObjectG.getDObject!(TreePath)(outpath); 1055 column = ObjectG.getDObject!(TreeViewColumn)(outcolumn); 1056 1057 return __p; 1058 } 1059 1060 /** 1061 * Returns whether a rubber banding operation is currently being done 1062 * in @tree_view. 1063 * 1064 * Returns: %TRUE if a rubber banding operation is currently being 1065 * done in @tree_view. 1066 */ 1067 public bool isRubberBandingActive() 1068 { 1069 return gtk_tree_view_is_rubber_banding_active(gtkTreeView) != 0; 1070 } 1071 1072 /** 1073 * Calls @func on all expanded rows. 1074 * 1075 * Params: 1076 * func = A function to be called 1077 * data = User data to be passed to the function. 1078 */ 1079 public void mapExpandedRows(GtkTreeViewMappingFunc func, void* data) 1080 { 1081 gtk_tree_view_map_expanded_rows(gtkTreeView, func, data); 1082 } 1083 1084 /** 1085 * Moves @column to be after to @base_column. If @base_column is %NULL, then 1086 * @column is placed in the first position. 1087 * 1088 * Params: 1089 * column = The `GtkTreeViewColumn` to be moved. 1090 * baseColumn = The `GtkTreeViewColumn` to be moved relative to 1091 */ 1092 public void moveColumnAfter(TreeViewColumn column, TreeViewColumn baseColumn) 1093 { 1094 gtk_tree_view_move_column_after(gtkTreeView, (column is null) ? null : column.getTreeViewColumnStruct(), (baseColumn is null) ? null : baseColumn.getTreeViewColumnStruct()); 1095 } 1096 1097 /** 1098 * Removes @column from @tree_view. 1099 * 1100 * Params: 1101 * column = The `GtkTreeViewColumn` to remove. 1102 * 1103 * Returns: The number of columns in @tree_view after removing. 1104 */ 1105 public int removeColumn(TreeViewColumn column) 1106 { 1107 return gtk_tree_view_remove_column(gtkTreeView, (column is null) ? null : column.getTreeViewColumnStruct()); 1108 } 1109 1110 /** 1111 * Activates the cell determined by @path and @column. 1112 * 1113 * Params: 1114 * path = The `GtkTreePath` to be activated. 1115 * column = The `GtkTreeViewColumn` to be activated. 1116 */ 1117 public void rowActivated(TreePath path, TreeViewColumn column) 1118 { 1119 gtk_tree_view_row_activated(gtkTreeView, (path is null) ? null : path.getTreePathStruct(), (column is null) ? null : column.getTreeViewColumnStruct()); 1120 } 1121 1122 /** 1123 * Returns %TRUE if the node pointed to by @path is expanded in @tree_view. 1124 * 1125 * Params: 1126 * path = A `GtkTreePath` to test expansion state. 1127 * 1128 * Returns: %TRUE if #path is expanded. 1129 */ 1130 public bool rowExpanded(TreePath path) 1131 { 1132 return gtk_tree_view_row_expanded(gtkTreeView, (path is null) ? null : path.getTreePathStruct()) != 0; 1133 } 1134 1135 /** 1136 * Moves the alignments of @tree_view to the position specified by @column and 1137 * @path. If @column is %NULL, then no horizontal scrolling occurs. Likewise, 1138 * if @path is %NULL no vertical scrolling occurs. At a minimum, one of @column 1139 * or @path need to be non-%NULL. @row_align determines where the row is 1140 * placed, and @col_align determines where @column is placed. Both are expected 1141 * to be between 0.0 and 1.0. 0.0 means left/top alignment, 1.0 means 1142 * right/bottom alignment, 0.5 means center. 1143 * 1144 * If @use_align is %FALSE, then the alignment arguments are ignored, and the 1145 * tree does the minimum amount of work to scroll the cell onto the screen. 1146 * This means that the cell will be scrolled to the edge closest to its current 1147 * position. If the cell is currently visible on the screen, nothing is done. 1148 * 1149 * This function only works if the model is set, and @path is a valid row on the 1150 * model. If the model changes before the @tree_view is realized, the centered 1151 * path will be modified to reflect this change. 1152 * 1153 * Params: 1154 * path = The path of the row to move to 1155 * column = The `GtkTreeViewColumn` to move horizontally to 1156 * useAlign = whether to use alignment arguments, or %FALSE. 1157 * rowAlign = The vertical alignment of the row specified by @path. 1158 * colAlign = The horizontal alignment of the column specified by @column. 1159 */ 1160 public void scrollToCell(TreePath path, TreeViewColumn column, bool useAlign, float rowAlign, float colAlign) 1161 { 1162 gtk_tree_view_scroll_to_cell(gtkTreeView, (path is null) ? null : path.getTreePathStruct(), (column is null) ? null : column.getTreeViewColumnStruct(), useAlign, rowAlign, colAlign); 1163 } 1164 1165 /** 1166 * Scrolls the tree view such that the top-left corner of the visible 1167 * area is @tree_x, @tree_y, where @tree_x and @tree_y are specified 1168 * in tree coordinates. The @tree_view must be realized before 1169 * this function is called. If it isn't, you probably want to be 1170 * using gtk_tree_view_scroll_to_cell(). 1171 * 1172 * If either @tree_x or @tree_y are -1, then that direction isn’t scrolled. 1173 * 1174 * Params: 1175 * treeX = X coordinate of new top-left pixel of visible area, or -1 1176 * treeY = Y coordinate of new top-left pixel of visible area, or -1 1177 */ 1178 public void scrollToPoint(int treeX, int treeY) 1179 { 1180 gtk_tree_view_scroll_to_point(gtkTreeView, treeX, treeY); 1181 } 1182 1183 /** 1184 * Cause the `GtkTreeView`::row-activated signal to be emitted 1185 * on a single click instead of a double click. 1186 * 1187 * Params: 1188 * single = %TRUE to emit row-activated on a single click 1189 */ 1190 public void setActivateOnSingleClick(bool single) 1191 { 1192 gtk_tree_view_set_activate_on_single_click(gtkTreeView, single); 1193 } 1194 1195 /** 1196 * Sets a user function for determining where a column may be dropped when 1197 * dragged. This function is called on every column pair in turn at the 1198 * beginning of a column drag to determine where a drop can take place. The 1199 * arguments passed to @func are: the @tree_view, the `GtkTreeViewColumn` being 1200 * dragged, the two `GtkTreeViewColumn`s determining the drop spot, and 1201 * @user_data. If either of the `GtkTreeViewColumn` arguments for the drop spot 1202 * are %NULL, then they indicate an edge. If @func is set to be %NULL, then 1203 * @tree_view reverts to the default behavior of allowing all columns to be 1204 * dropped everywhere. 1205 * 1206 * Params: 1207 * func = A function to determine which columns are reorderable 1208 * userData = User data to be passed to @func 1209 * destroy = Destroy notifier for @user_data 1210 */ 1211 public void setColumnDragFunction(GtkTreeViewColumnDropFunc func, void* userData, GDestroyNotify destroy) 1212 { 1213 gtk_tree_view_set_column_drag_function(gtkTreeView, func, userData, destroy); 1214 } 1215 1216 /** 1217 * Sets the current keyboard focus to be at @path, and selects it. This is 1218 * useful when you want to focus the user’s attention on a particular row. If 1219 * @focus_column is not %NULL, then focus is given to the column specified by 1220 * it. Additionally, if @focus_column is specified, and @start_editing is 1221 * %TRUE, then editing should be started in the specified cell. 1222 * This function is often followed by @gtk_widget_grab_focus (@tree_view) 1223 * in order to give keyboard focus to the widget. Please note that editing 1224 * can only happen when the widget is realized. 1225 * 1226 * If @path is invalid for @model, the current cursor (if any) will be unset 1227 * and the function will return without failing. 1228 * 1229 * Params: 1230 * path = A `GtkTreePath` 1231 * focusColumn = A `GtkTreeViewColumn` 1232 * startEditing = %TRUE if the specified cell should start being edited. 1233 */ 1234 public void setCursor(TreePath path, TreeViewColumn focusColumn, bool startEditing) 1235 { 1236 gtk_tree_view_set_cursor(gtkTreeView, (path is null) ? null : path.getTreePathStruct(), (focusColumn is null) ? null : focusColumn.getTreeViewColumnStruct(), startEditing); 1237 } 1238 1239 /** 1240 * Sets the current keyboard focus to be at @path, and selects it. This is 1241 * useful when you want to focus the user’s attention on a particular row. If 1242 * @focus_column is not %NULL, then focus is given to the column specified by 1243 * it. If @focus_column and @focus_cell are not %NULL, and @focus_column 1244 * contains 2 or more editable or activatable cells, then focus is given to 1245 * the cell specified by @focus_cell. Additionally, if @focus_column is 1246 * specified, and @start_editing is %TRUE, then editing should be started in 1247 * the specified cell. This function is often followed by 1248 * @gtk_widget_grab_focus (@tree_view) in order to give keyboard focus to the 1249 * widget. Please note that editing can only happen when the widget is 1250 * realized. 1251 * 1252 * If @path is invalid for @model, the current cursor (if any) will be unset 1253 * and the function will return without failing. 1254 * 1255 * Params: 1256 * path = A `GtkTreePath` 1257 * focusColumn = A `GtkTreeViewColumn` 1258 * focusCell = A `GtkCellRenderer` 1259 * startEditing = %TRUE if the specified cell should start being edited. 1260 */ 1261 public void setCursorOnCell(TreePath path, TreeViewColumn focusColumn, CellRenderer focusCell, bool startEditing) 1262 { 1263 gtk_tree_view_set_cursor_on_cell(gtkTreeView, (path is null) ? null : path.getTreePathStruct(), (focusColumn is null) ? null : focusColumn.getTreeViewColumnStruct(), (focusCell is null) ? null : focusCell.getCellRendererStruct(), startEditing); 1264 } 1265 1266 /** 1267 * Sets the row that is highlighted for feedback. 1268 * If @path is %NULL, an existing highlight is removed. 1269 * 1270 * Params: 1271 * path = The path of the row to highlight 1272 * pos = Specifies whether to drop before, after or into the row 1273 */ 1274 public void setDragDestRow(TreePath path, GtkTreeViewDropPosition pos) 1275 { 1276 gtk_tree_view_set_drag_dest_row(gtkTreeView, (path is null) ? null : path.getTreePathStruct(), pos); 1277 } 1278 1279 /** 1280 * If @enable_search is set, then the user can type in text to search through 1281 * the tree interactively (this is sometimes called "typeahead find"). 1282 * 1283 * Note that even if this is %FALSE, the user can still initiate a search 1284 * using the “start-interactive-search” key binding. 1285 * 1286 * Params: 1287 * enableSearch = %TRUE, if the user can search interactively 1288 */ 1289 public void setEnableSearch(bool enableSearch) 1290 { 1291 gtk_tree_view_set_enable_search(gtkTreeView, enableSearch); 1292 } 1293 1294 /** 1295 * Sets whether to draw lines interconnecting the expanders in @tree_view. 1296 * This does not have any visible effects for lists. 1297 * 1298 * Params: 1299 * enabled = %TRUE to enable tree line drawing, %FALSE otherwise. 1300 */ 1301 public void setEnableTreeLines(bool enabled) 1302 { 1303 gtk_tree_view_set_enable_tree_lines(gtkTreeView, enabled); 1304 } 1305 1306 /** 1307 * Sets the column to draw the expander arrow at. It must be in @tree_view. 1308 * If @column is %NULL, then the expander arrow is always at the first 1309 * visible column. 1310 * 1311 * If you do not want expander arrow to appear in your tree, set the 1312 * expander column to a hidden column. 1313 * 1314 * Params: 1315 * column = %NULL, or the column to draw the expander arrow at. 1316 */ 1317 public void setExpanderColumn(TreeViewColumn column) 1318 { 1319 gtk_tree_view_set_expander_column(gtkTreeView, (column is null) ? null : column.getTreeViewColumnStruct()); 1320 } 1321 1322 /** 1323 * Enables or disables the fixed height mode of @tree_view. 1324 * Fixed height mode speeds up `GtkTreeView` by assuming that all 1325 * rows have the same height. 1326 * Only enable this option if all rows are the same height and all 1327 * columns are of type %GTK_TREE_VIEW_COLUMN_FIXED. 1328 * 1329 * Params: 1330 * enable = %TRUE to enable fixed height mode 1331 */ 1332 public void setFixedHeightMode(bool enable) 1333 { 1334 gtk_tree_view_set_fixed_height_mode(gtkTreeView, enable); 1335 } 1336 1337 /** 1338 * Sets which grid lines to draw in @tree_view. 1339 * 1340 * Params: 1341 * gridLines = a `GtkTreeView`GridLines value indicating which grid lines to 1342 * enable. 1343 */ 1344 public void setGridLines(GtkTreeViewGridLines gridLines) 1345 { 1346 gtk_tree_view_set_grid_lines(gtkTreeView, gridLines); 1347 } 1348 1349 /** 1350 * Allow the column title buttons to be clicked. 1351 * 1352 * Params: 1353 * setting = %TRUE if the columns are clickable. 1354 */ 1355 public void setHeadersClickable(bool setting) 1356 { 1357 gtk_tree_view_set_headers_clickable(gtkTreeView, setting); 1358 } 1359 1360 /** 1361 * Sets the visibility state of the headers. 1362 * 1363 * Params: 1364 * headersVisible = %TRUE if the headers are visible 1365 */ 1366 public void setHeadersVisible(bool headersVisible) 1367 { 1368 gtk_tree_view_set_headers_visible(gtkTreeView, headersVisible); 1369 } 1370 1371 /** 1372 * Enables or disables the hover expansion mode of @tree_view. 1373 * Hover expansion makes rows expand or collapse if the pointer 1374 * moves over them. 1375 * 1376 * Params: 1377 * expand = %TRUE to enable hover selection mode 1378 */ 1379 public void setHoverExpand(bool expand) 1380 { 1381 gtk_tree_view_set_hover_expand(gtkTreeView, expand); 1382 } 1383 1384 /** 1385 * Enables or disables the hover selection mode of @tree_view. 1386 * Hover selection makes the selected row follow the pointer. 1387 * Currently, this works only for the selection modes 1388 * %GTK_SELECTION_SINGLE and %GTK_SELECTION_BROWSE. 1389 * 1390 * Params: 1391 * hover = %TRUE to enable hover selection mode 1392 */ 1393 public void setHoverSelection(bool hover) 1394 { 1395 gtk_tree_view_set_hover_selection(gtkTreeView, hover); 1396 } 1397 1398 /** 1399 * Sets the amount of extra indentation for child levels to use in @tree_view 1400 * in addition to the default indentation. The value should be specified in 1401 * pixels, a value of 0 disables this feature and in this case only the default 1402 * indentation will be used. 1403 * This does not have any visible effects for lists. 1404 * 1405 * Params: 1406 * indentation = the amount, in pixels, of extra indentation in @tree_view. 1407 */ 1408 public void setLevelIndentation(int indentation) 1409 { 1410 gtk_tree_view_set_level_indentation(gtkTreeView, indentation); 1411 } 1412 1413 /** 1414 * Sets the model for a `GtkTreeView`. If the @tree_view already has a model 1415 * set, it will remove it before setting the new model. If @model is %NULL, 1416 * then it will unset the old model. 1417 * 1418 * Params: 1419 * model = The model. 1420 */ 1421 public void setModel(TreeModelIF model) 1422 { 1423 gtk_tree_view_set_model(gtkTreeView, (model is null) ? null : model.getTreeModelStruct()); 1424 } 1425 1426 /** 1427 * This function is a convenience function to allow you to reorder 1428 * models that support the `GtkTreeDragSourceIface` and the 1429 * `GtkTreeDragDestIface`. Both `GtkTreeStore` and `GtkListStore` support 1430 * these. If @reorderable is %TRUE, then the user can reorder the 1431 * model by dragging and dropping rows. The developer can listen to 1432 * these changes by connecting to the model’s `GtkTreeModel::row-inserted` 1433 * and `GtkTreeModel::row-deleted` signals. The reordering is implemented 1434 * by setting up the tree view as a drag source and destination. 1435 * Therefore, drag and drop can not be used in a reorderable view for any 1436 * other purpose. 1437 * 1438 * This function does not give you any degree of control over the order -- any 1439 * reordering is allowed. If more control is needed, you should probably 1440 * handle drag and drop manually. 1441 * 1442 * Params: 1443 * reorderable = %TRUE, if the tree can be reordered. 1444 */ 1445 public void setReorderable(bool reorderable) 1446 { 1447 gtk_tree_view_set_reorderable(gtkTreeView, reorderable); 1448 } 1449 1450 /** 1451 * Sets the row separator function, which is used to determine 1452 * whether a row should be drawn as a separator. If the row separator 1453 * function is %NULL, no separators are drawn. This is the default value. 1454 * 1455 * Params: 1456 * func = a `GtkTreeView`RowSeparatorFunc 1457 * data = user data to pass to @func 1458 * destroy = destroy notifier for @data 1459 */ 1460 public void setRowSeparatorFunc(GtkTreeViewRowSeparatorFunc func, void* data, GDestroyNotify destroy) 1461 { 1462 gtk_tree_view_set_row_separator_func(gtkTreeView, func, data, destroy); 1463 } 1464 1465 /** 1466 * Enables or disables rubber banding in @tree_view. If the selection mode 1467 * is %GTK_SELECTION_MULTIPLE, rubber banding will allow the user to select 1468 * multiple rows by dragging the mouse. 1469 * 1470 * Params: 1471 * enable = %TRUE to enable rubber banding 1472 */ 1473 public void setRubberBanding(bool enable) 1474 { 1475 gtk_tree_view_set_rubber_banding(gtkTreeView, enable); 1476 } 1477 1478 /** 1479 * Sets @column as the column where the interactive search code should 1480 * search in for the current model. 1481 * 1482 * If the search column is set, users can use the “start-interactive-search” 1483 * key binding to bring up search popup. The enable-search property controls 1484 * whether simply typing text will also start an interactive search. 1485 * 1486 * Note that @column refers to a column of the current model. The search 1487 * column is reset to -1 when the model is changed. 1488 * 1489 * Params: 1490 * column = the column of the model to search in, or -1 to disable searching 1491 */ 1492 public void setSearchColumn(int column) 1493 { 1494 gtk_tree_view_set_search_column(gtkTreeView, column); 1495 } 1496 1497 /** 1498 * Sets the entry which the interactive search code will use for this 1499 * @tree_view. This is useful when you want to provide a search entry 1500 * in our interface at all time at a fixed position. Passing %NULL for 1501 * @entry will make the interactive search code use the built-in popup 1502 * entry again. 1503 * 1504 * Params: 1505 * entry = the entry the interactive search code of @tree_view should use 1506 */ 1507 public void setSearchEntry(EditableIF entry) 1508 { 1509 gtk_tree_view_set_search_entry(gtkTreeView, (entry is null) ? null : entry.getEditableStruct()); 1510 } 1511 1512 /** 1513 * Sets the compare function for the interactive search capabilities; note 1514 * that somewhat like strcmp() returning 0 for equality 1515 * `GtkTreeView`SearchEqualFunc returns %FALSE on matches. 1516 * 1517 * Params: 1518 * searchEqualFunc = the compare function to use during the search 1519 * searchUserData = user data to pass to @search_equal_func 1520 * searchDestroy = Destroy notifier for @search_user_data 1521 */ 1522 public void setSearchEqualFunc(GtkTreeViewSearchEqualFunc searchEqualFunc, void* searchUserData, GDestroyNotify searchDestroy) 1523 { 1524 gtk_tree_view_set_search_equal_func(gtkTreeView, searchEqualFunc, searchUserData, searchDestroy); 1525 } 1526 1527 /** 1528 * Sets whether to draw and enable expanders and indent child rows in 1529 * @tree_view. When disabled there will be no expanders visible in trees 1530 * and there will be no way to expand and collapse rows by default. Also 1531 * note that hiding the expanders will disable the default indentation. You 1532 * can set a custom indentation in this case using 1533 * gtk_tree_view_set_level_indentation(). 1534 * This does not have any visible effects for lists. 1535 * 1536 * Params: 1537 * enabled = %TRUE to enable expander drawing, %FALSE otherwise. 1538 */ 1539 public void setShowExpanders(bool enabled) 1540 { 1541 gtk_tree_view_set_show_expanders(gtkTreeView, enabled); 1542 } 1543 1544 /** 1545 * Sets the tip area of @tooltip to the area @path, @column and @cell have 1546 * in common. For example if @path is %NULL and @column is set, the tip 1547 * area will be set to the full area covered by @column. See also 1548 * gtk_tooltip_set_tip_area(). 1549 * 1550 * Note that if @path is not specified and @cell is set and part of a column 1551 * containing the expander, the tooltip might not show and hide at the correct 1552 * position. In such cases @path must be set to the current node under the 1553 * mouse cursor for this function to operate correctly. 1554 * 1555 * See also gtk_tree_view_set_tooltip_column() for a simpler alternative. 1556 * 1557 * Params: 1558 * tooltip = a `GtkTooltip` 1559 * path = a `GtkTreePath` 1560 * column = a `GtkTreeViewColumn` 1561 * cell = a `GtkCellRenderer` 1562 */ 1563 public void setTooltipCell(Tooltip tooltip, TreePath path, TreeViewColumn column, CellRenderer cell) 1564 { 1565 gtk_tree_view_set_tooltip_cell(gtkTreeView, (tooltip is null) ? null : tooltip.getTooltipStruct(), (path is null) ? null : path.getTreePathStruct(), (column is null) ? null : column.getTreeViewColumnStruct(), (cell is null) ? null : cell.getCellRendererStruct()); 1566 } 1567 1568 /** 1569 * If you only plan to have simple (text-only) tooltips on full rows, you 1570 * can use this function to have `GtkTreeView` handle these automatically 1571 * for you. @column should be set to the column in @tree_view’s model 1572 * containing the tooltip texts, or -1 to disable this feature. 1573 * 1574 * When enabled, `GtkWidget:has-tooltip` will be set to %TRUE and 1575 * @tree_view will connect a `GtkWidget::query-tooltip` signal handler. 1576 * 1577 * Note that the signal handler sets the text with gtk_tooltip_set_markup(), 1578 * so &, <, etc have to be escaped in the text. 1579 * 1580 * Params: 1581 * column = an integer, which is a valid column number for @tree_view’s model 1582 */ 1583 public void setTooltipColumn(int column) 1584 { 1585 gtk_tree_view_set_tooltip_column(gtkTreeView, column); 1586 } 1587 1588 /** 1589 * Sets the tip area of @tooltip to be the area covered by the row at @path. 1590 * See also gtk_tree_view_set_tooltip_column() for a simpler alternative. 1591 * See also gtk_tooltip_set_tip_area(). 1592 * 1593 * Params: 1594 * tooltip = a `GtkTooltip` 1595 * path = a `GtkTreePath` 1596 */ 1597 public void setTooltipRow(Tooltip tooltip, TreePath path) 1598 { 1599 gtk_tree_view_set_tooltip_row(gtkTreeView, (tooltip is null) ? null : tooltip.getTooltipStruct(), (path is null) ? null : path.getTreePathStruct()); 1600 } 1601 1602 /** 1603 * Undoes the effect of 1604 * gtk_tree_view_enable_model_drag_dest(). Calling this method sets 1605 * `GtkTreeView`:reorderable to %FALSE. 1606 */ 1607 public void unsetRowsDragDest() 1608 { 1609 gtk_tree_view_unset_rows_drag_dest(gtkTreeView); 1610 } 1611 1612 /** 1613 * Undoes the effect of 1614 * gtk_tree_view_enable_model_drag_source(). Calling this method sets 1615 * `GtkTreeView`:reorderable to %FALSE. 1616 */ 1617 public void unsetRowsDragSource() 1618 { 1619 gtk_tree_view_unset_rows_drag_source(gtkTreeView); 1620 } 1621 1622 /** 1623 * The number of columns of the treeview has changed. 1624 */ 1625 gulong addOnColumnsChanged(void delegate(TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1626 { 1627 return Signals.connect(this, "columns-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1628 } 1629 1630 /** 1631 * The position of the cursor (focused cell) has changed. 1632 */ 1633 gulong addOnCursorChanged(void delegate(TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1634 { 1635 return Signals.connect(this, "cursor-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1636 } 1637 1638 /** */ 1639 gulong addOnExpandCollapseCursorRow(bool delegate(bool, bool, bool, TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1640 { 1641 return Signals.connect(this, "expand-collapse-cursor-row", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1642 } 1643 1644 /** 1645 * The `GtkTreeView`::move-cursor signal is a [keybinding 1646 * signal][class@Gtk.SignalAction] which gets emitted when the user 1647 * presses one of the cursor keys. 1648 * 1649 * Applications should not connect to it, but may emit it with 1650 * g_signal_emit_by_name() if they need to control the cursor 1651 * programmatically. In contrast to gtk_tree_view_set_cursor() and 1652 * gtk_tree_view_set_cursor_on_cell() when moving horizontally 1653 * `GtkTreeView`::move-cursor does not reset the current selection. 1654 * 1655 * Params: 1656 * step = the granularity of the move, as a `GtkMovementStep`. 1657 * %GTK_MOVEMENT_LOGICAL_POSITIONS, %GTK_MOVEMENT_VISUAL_POSITIONS, 1658 * %GTK_MOVEMENT_DISPLAY_LINES, %GTK_MOVEMENT_PAGES and 1659 * %GTK_MOVEMENT_BUFFER_ENDS are supported. 1660 * %GTK_MOVEMENT_LOGICAL_POSITIONS and %GTK_MOVEMENT_VISUAL_POSITIONS 1661 * are treated identically. 1662 * direction = the direction to move: +1 to move forwards; -1 to move 1663 * backwards. The resulting movement is undefined for all other values. 1664 * extend = whether to extend the selection 1665 * modify = whether to modify the selection 1666 * 1667 * Returns: %TRUE if @step is supported, %FALSE otherwise. 1668 */ 1669 gulong addOnMoveCursor(bool delegate(GtkMovementStep, int, bool, bool, TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1670 { 1671 return Signals.connect(this, "move-cursor", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1672 } 1673 1674 /** 1675 * The "row-activated" signal is emitted when the method 1676 * [`method@Gtk.TreeView.row_activated`] is called. 1677 * 1678 * This signal is emitted when the user double-clicks a treeview row with the 1679 * [property@Gtk.TreeView:activate-on-single-click] property set to %FALSE, 1680 * or when the user single-clicks a row when that property set to %TRUE. 1681 * 1682 * This signal is also emitted when a non-editable row is selected and one 1683 * of the keys: <kbd>Space</kbd>, <kbd>Shift</kbd>+<kbd>Space</kbd>, 1684 * <kbd>Return</kbd> or <kbd>Enter</kbd> is pressed. 1685 * 1686 * For selection handling refer to the 1687 * [tree widget conceptual overview](section-tree-widget.html) 1688 * as well as `GtkTreeSelection`. 1689 * 1690 * Params: 1691 * path = the `GtkTreePath` for the activated row 1692 * column = the `GtkTreeViewColumn` in which the activation occurred 1693 */ 1694 gulong addOnRowActivated(void delegate(TreePath, TreeViewColumn, TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1695 { 1696 return Signals.connect(this, "row-activated", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1697 } 1698 1699 /** 1700 * The given row has been collapsed (child nodes are hidden). 1701 * 1702 * Params: 1703 * iter = the tree iter of the collapsed row 1704 * path = a tree path that points to the row 1705 */ 1706 gulong addOnRowCollapsed(void delegate(TreeIter, TreePath, TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1707 { 1708 return Signals.connect(this, "row-collapsed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1709 } 1710 1711 /** 1712 * The given row has been expanded (child nodes are shown). 1713 * 1714 * Params: 1715 * iter = the tree iter of the expanded row 1716 * path = a tree path that points to the row 1717 */ 1718 gulong addOnRowExpanded(void delegate(TreeIter, TreePath, TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1719 { 1720 return Signals.connect(this, "row-expanded", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1721 } 1722 1723 /** */ 1724 gulong addOnSelectAll(bool delegate(TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1725 { 1726 return Signals.connect(this, "select-all", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1727 } 1728 1729 /** */ 1730 gulong addOnSelectCursorParent(bool delegate(TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1731 { 1732 return Signals.connect(this, "select-cursor-parent", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1733 } 1734 1735 /** */ 1736 gulong addOnSelectCursorRow(bool delegate(bool, TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1737 { 1738 return Signals.connect(this, "select-cursor-row", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1739 } 1740 1741 /** */ 1742 gulong addOnStartInteractiveSearch(bool delegate(TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1743 { 1744 return Signals.connect(this, "start-interactive-search", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1745 } 1746 1747 /** 1748 * The given row is about to be collapsed (hide its children nodes). Use this 1749 * signal if you need to control the collapsibility of individual rows. 1750 * 1751 * Params: 1752 * iter = the tree iter of the row to collapse 1753 * path = a tree path that points to the row 1754 * 1755 * Returns: %FALSE to allow collapsing, %TRUE to reject 1756 */ 1757 gulong addOnTestCollapseRow(bool delegate(TreeIter, TreePath, TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1758 { 1759 return Signals.connect(this, "test-collapse-row", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1760 } 1761 1762 /** 1763 * The given row is about to be expanded (show its children nodes). Use this 1764 * signal if you need to control the expandability of individual rows. 1765 * 1766 * Params: 1767 * iter = the tree iter of the row to expand 1768 * path = a tree path that points to the row 1769 * 1770 * Returns: %FALSE to allow expansion, %TRUE to reject 1771 */ 1772 gulong addOnTestExpandRow(bool delegate(TreeIter, TreePath, TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1773 { 1774 return Signals.connect(this, "test-expand-row", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1775 } 1776 1777 /** */ 1778 gulong addOnToggleCursorRow(bool delegate(TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1779 { 1780 return Signals.connect(this, "toggle-cursor-row", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1781 } 1782 1783 /** */ 1784 gulong addOnUnselectAll(bool delegate(TreeView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1785 { 1786 return Signals.connect(this, "unselect-all", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1787 } 1788 }